﻿@using OBUCare.Web.Infrastructure
@using OBUCare.Core.BL
@using OBUCare.Core.DataAccess;
@{
    ObuDropDownListHlper ddlHelper = new ObuDropDownListHlper();
}
@using (Html.BeginForm("ObuHistoryInfoSearch", "Report", FormMethod.Post, new { ID = "searchForm" }))
{
    <table width="100%">
        <tr>
            <td style="width: 10%; text-align: right">
                标签号：
            </td>
            <td style="width: 20%; text-align: left">
                @Html.TextBox("txtObuNo", "", new { @style = "width:170px;height:15px", @MaxLength = 16 })
            </td>
            <td style="width: 10%; text-align: right">
                操作日期：
            </td>
            <td style="width: 20%; text-align: left">
                @Html.Telerik().DatePicker().Name("sDate").HtmlAttributes(new { @style = "width:140px;" }).OpenOnFocus(true).ShowButton(false)
                至
                @Html.Telerik().DatePicker().Name("eDate").HtmlAttributes(new { @style = "width:140px;" }).OpenOnFocus(true).ShowButton(false)
            </td>
        </tr>
        <tr>
            <td style="width: 10%; text-align: right">
                客户编号：
            </td>
            <td style="width: 30%; text-align: left">
                @Html.TextBox("txtCustomerNo", "", new { @style = "width:170px;height:15px", @MaxLength =12 })
            </td>
            <td style="width: 10%; text-align: right">
                车牌号：
            </td>
            <td style="width: 30%; text-align: left">
                @Html.TextBox("txtCarNo", "", new { @style = "width:150px;height:15px", @MaxLength = 20 })
            </td>
        </tr>
        <tr>
            <td style="text-align: right"></td>
            <td style="text-align: left"></td>
            <td style="text-align: center"></td>
            <td style="text-align: center">
                <input type="button" value="查询" id="btnSearch" onclick="search()" />
                @Html.Hidden("dateSql", "", new { @id = "dateSql" })
                @Html.Hidden("obuNoSql", "", new { @id = "obuNoSql" })
                @Html.Hidden("userSql", "", new { @id = "userSql" })
                @Html.Hidden("carSql", "", new { @id = "carSql" })
            </td>
        </tr>
    </table>
}
<script type="text/javascript">

    function search() {
        var form = $("#searchForm");
        dataString = form.serialize();
        $.ajax({
            type: "POST",
            url: form.attr('action'),
            data: dataString,
            cache: false,
            dataType: "json",
            success: function (data) {

                if (data.Success) {
                    //alert('成功');
                    //debugger;
                    var grid = $('#Grid').data('tGrid');
                    $('#dateSql').val(data.DateSql);
                    $('#obuNoSql').val(data.ObuNoSql);
                    $('#userSql').val(data.UserSql);
                    $('#carSql').val(data.CarSql);
                    grid.rebind();
                }
                else {
                    alert('失败：' + data.ErrorMsg)
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                var err = XMLHttpRequest + "<br />" + textStatus + "<br />" + errorThrown;
                alert(err);
            }
        });
    }

</script>
@{
    ddlHelper.Dispose();
}
